package C9_7_IntroduceNullObject;

/**
 * @author xugang1
 * @updated 2022/7/25
 * @description 引入Null对象
 */

public class IntroduceNullObject {
    Site site;
    Customer customer = site.getCustomer();

    BillingPlan plan;
    if(customer==null) plan =BillingPlan.basic();
    else plan=customer.getPlan();

    String customerName;
    if(customer==null) customerName ="occupant";
    else customerName=customer.getName();

    int weeksDelinquent;
    if(customer==null) weeksDelinquent =0;
    else weeksDelinquent=customer.getHistory().getWeeksDelinquentInLastYear();
}